<?php
class logs {

	function logs() {
		
	}
	function index(){
		$view=$this->jieku->getView();
	}
	function get(){
		$db=$this->jieku->getDB();
		$view=$this->jieku->getView();
		$start = intval($this->jieku->var["start"]);
    	$limit = 30;
		$db->query(JDBTool::select("count(*) as `count`","sys_log_index",'',true));
		$view->add("resCount", $db->getCount());
		$db->query(JDBTool::select("m.username as member_id,l.id,l.postDate,l.url,l.ip","sys_log_index as l,sys_member as m","m.id=l.member_id order by l.postDate DESC limit $start , $limit",true),PDO::FETCH_ASSOC);
		$view->add("logsList",$db->getAll());
	}
	function alllog(){
		$db=$this->jieku->getDB();
		$id=$this->jieku->var[id];
		$db->query(JDBTool::select("postData","sys_log_data",array("log_index_id"=>$id),true));
		$res=$db->getAll();
		print_r(unserialize($res[0][postData]));
	}
	function delete(){
		$db=$this->jieku->getDB();
		$ids=$this->jieku->var[ids];
		$ids=explode(",",$ids);
		foreach ($ids as $id){
			if (strlen($id)>0){
				$db->exec(JDBTool::delete("sys_log_index",array("id"=>$id),true));
				$db->exec(JDBTool::delete("sys_log_data",array("log_index_id"=>$id),true));
			}
		}
		echo "success";
	}
}
?>